﻿using Microsoft.AspNetCore.Hosting;
using System.IO;
using SystemCenterSoa.BaseLibrary.Tools.losTools;

namespace Macro_stone.BaseLibrary.Tools.FileTools
{
    public class FileTools
    {
        public static string GetFileExtension(string filePath)
        {
            return Path.GetExtension(filePath);
        }

        /// <summary>
        /// 实现Server.MapPath
        /// </summary>
        /// <param name="path">相对路径</param>
        /// <returns></returns>
        public static string MapPath(string path)
        {
            var iHostingEnvironment = DiTools.GetDiObj<IHostingEnvironment>();
            string rootdir = iHostingEnvironment.ContentRootPath;
            string root = rootdir + path;
            return root;
        }
    }
}
